package com.jambo.yudada.mapper;

import com.jambo.yudada.model.dto.userAnswer.AppAnswerCountDTO;
import com.jambo.yudada.model.dto.userAnswer.AppAnswerResultCountDTO;
import com.jambo.yudada.model.entity.UserAnswer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author lenovo-chen
* @description 针对表【user_answer(用户答题记录)】的数据库操作Mapper
* @createDate 2025-04-03 21:23:38
* @Entity com.jambo.yudada.model.entity.UserAnswer
*/
public interface UserAnswerMapper extends BaseMapper<UserAnswer> {
    @Select("select appId ,count(userId)as answerCount from yudada.user_answer group by appId order by answerCount desc limit 10")
    List<AppAnswerCountDTO> getTop10App();

        @Select("select resultName, count(resultName) as resultCount from yudada.user_answer " +
                "where appId = #{appId} group by resultName order by resultCount desc")
        List<AppAnswerResultCountDTO> doAppAnswerResultCount(Long appId);
    }





